import 'package:dio/dio.dart';
import 'package:test/network/dio_helper.dart';

class Request {
  static final Dio _dio = DioHelper.getInstance();

  // 封装 GET 请求
  static Future<Response> get(String path, {Map<String, dynamic>? queryParameters}) async {
    try {
      return await _dio.get(path, queryParameters: queryParameters);
    } catch (e) {
      rethrow;
    }
  }

  // 封装 POST 请求
  static Future<Response> post(String path, {dynamic data}) async {
    try {
      return await _dio.post(path, data: data);
    } catch (e) {
      rethrow;
    }
  }

  // 可以根据需要封装更多请求方法，如 PUT、DELETE 等
}
